Xbasic

SQL::ResultSetExecutePostProcess Method

Syntax

Result as L = ExecutePostProcess(ResultSet BYREF as SQL::ResultSet, selectStatement as c [,args as sql::Arguments])

Arguments

ResultSetSQL::ResultSet

A result set that will be populated with the results of the query.

selectStatementCharacter

A SQL statement to execute.

argsSQL::Arguments

Arguments used in the SQL statement.

Returns

ResultLogical

Returns .T. if the operation succeeds. Otherwise .F.. If the operation fails, additional information can be found in the SQL::ResultSet's CallResult property.

Description

Execute portable SQL against a SQL::ResultSet, Allows for filtering after fetching a result set.

Discussion

The SQL::ResultSet::ExecutePostProcess method can be used to execute a SQL query against a ResultSet.

In the following example, all the customers in the Northwind database are fetched. The resulting SQL::ResultSet for the query is then filtered to get the records for only customers in France.

dim cn as sql::Connection
? cn.Open("::Name::AADemo-Northwind")
= .T.

? cn.Execute("select * from customers")
= .T.

dim rs as sql::ResultSet
? cn.ResultSet.ExecutePostProcess(rs,"select distinct city from customers where country = 'France' order by city")
= .T.

? rs.ToString()
= Lille
Lyon
Marseille
Nantes
Paris
Reims
Strasbourg
Toulouse
Versailles

In addition to SQL data sources, a SQL::ResultSet can be created from other data formats, including JSON, BSON, or MongoDB: